import gtk
import gobject
import gio
from mmxfer import mediatype
import threading


columns=[
			("name",gobject.TYPE_STRING),
			("status",gobject.TYPE_STRING),
			("progress",gobject.TYPE_FLOAT),
			("uri",gobject.TYPE_STRING),
			("type",gobject.TYPE_INT),
			("waiting",gobject.TYPE_BOOLEAN),
			("tmp",gobject.TYPE_PYOBJECT),
			]
column_dict={}
for i,(s,t) in enumerate(columns):
	column_dict[s]=i
def column(name):
	return column_dict[name]
def build_column(uri):
	f=gio.File(uri)
	name=f.get_basename()
	progress=0.0
	type=mediatype.find_type(uri)
	status=mediatype.get_description(type,True)
	waiting=True
	tmp=[]
	return (name,status,progress,uri,type,waiting,tmp)

class Store(gtk.ListStore):
	def __init__(self):
		gtk.ListStore.__init__(self,*[type for name,type in columns])
		self.quit_event=threading.Event()
		self.quit_event.clear()



